package com.systop.dxjj.modules.user.mapper;


import com.systop.dxjj.common.pojo.Teacher;
import com.systop.dxjj.common.pojo.User;
import com.systop.dxjj.common.utils.R;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author 吴健伟
 */
@Mapper
public interface UserMapper {
    /**
     * 查询所有用户信息
     */
    @Select("select * from user")
    List<User> selectAllUsers();

    /**
     * 管理员登录
     */
    @Select("select username,password from user where username=#{username} and password=#{password}")
    User loginUser(User user);

    /**
     *根据id查询用户信息
     */
    @Select("select * from user where userid=#{userid}")
    User selectUserById(Integer id);

    /**
     *根据姓名查询用户信息
     */
    @Select("select * from user where username=#{username}")
    User selectUserByName(String name);

    /**
     *插入用户信息
     */
    @Insert("insert into user(username,password) values (#{username},#{password})")
    int insertUser(User user);

    /**
     *删除用户信息
     */
    @Delete("delete from user where userid=#{userid}")
    int deleteUser(Integer id);

    /**
     *更新用户信息
     */
    @Update("update user set username=#{username},password=#{password} where userid=#{userid}")
    int updateUser(User user);
}

